<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class ArticleComment extends Model
{
    use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'article_comments';

    protected $fillable = ['article_id', 'member_id', 'nickname', 'avatar', 'article_id', 'content', 'status'];

    public function article()
    {
        return $this->belongsTo(Article::class, 'article_id', 'id');
    }

    public function member()
    {
        return $this->belongsTo(Member::class, 'member_id', 'id');
    }

    public function favorites()
    {
        return $this->hasMany(Favorite::class, 'article_comment_id', 'id');
    }
}
